#include <gtest/gtest.h>
#include <HeapMgr.h>

class HeapMgr_TestCase: public ::testing::Test
{
public:
	// Sets up the test fixture.
	virtual void SetUp(){}

	// Tears down the test fixture.
	virtual void TearDown()
	{
		HeapMgr::Get()->Clear();
	}

};


TEST_F(HeapMgr_TestCase, AllocStorage)
{
	for (int i = 1; i <= 100; i++)
	{
		void* p = HeapMgr::Get()->AllocStorage(i);
		ASSERT_EQ(HeapMgr::Get()->m_mMemoryUsed.size(), i);
	}

	int n = 10;
}

TEST_F(HeapMgr_TestCase, FreeStorage)
{

	void* p = HeapMgr::Get()->AllocStorage(10);
	ASSERT_EQ(HeapMgr::Get()->m_mMemoryUsed.size(), 1);

	HeapMgr::Get()->FreeStorage(p);
	ASSERT_EQ(HeapMgr::Get()->m_mMemoryUsed.size(), 0);

}